{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "try:\n",
    "    import cvxopt\n",
    "except ImportError:\n",
    "    import sys\n",
    "    !{sys.executable} -m pip install cvxopt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "# IMPORT PACKAGES\n",
    "from geoscilabs.em import UXO_TEM_Widget as UXO\n",
    "from IPython.display import display\n",
    "from ipywidgets import HBox"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Contents\n",
    "\n",
    "This app contains 3 widgets:\n",
    "\n",
    "* **Orientation and polarization widget:** This widget allows the user to visualize the orientation, infer the dimensions and change the polarizabilities of compact objects they wish to model.\n",
    "* **Data visualization widget:** This widget allows the user to visualize the step-off response of compact objects using three commonly used instruments: EM61, TEMTADS, and MPV.\n",
    "* **Parameter estimation widget:** This widget allows the user to invert synthetic data collected using EM61, TEMTADS or MPV instruments in order to recover the location and primary polarizabilities for a compact object.\n",
    "\n",
    "\n",
    "# Background Theory\n",
    "\n",
    "## Polarization Tensor\n",
    "\n",
    "The magnetic dipole moment ${\\bf m}$ being experienced by a compact object is given by:\n",
    "\n",
    "\\begin{equation}\n",
    "\\mathbf{m = Q \\, h_p}\n",
    "\\end{equation}\n",
    "\n",
    "where ${\\bf h_p} = [h_x,h_y,h_z]^T$ is the primary magnetic field caused by the transmitter before shut-off and ${\\bf Q}$ is the called the **polarizability tensor**. The polarizability tensor is a 3X3 symmetric, positive-definite (SPD) matrix given by:\n",
    "\n",
    "\\begin{equation}\n",
    "{\\bf Q} = \\begin{bmatrix} q_{11} & q_{12} & q_{13} \\\\ q_{12} & q_{22} & q_{23} \\\\ q_{13} & q_{23} & q_{33} \\end{bmatrix}\n",
    "\\end{equation}\n",
    "\n",
    "where $q_{ij}$ defines hows strongly field component $h_i$ contributes towards $m_j$.\n",
    "\n",
    "<img style=\"float: right; width: 500px\" src=\"https://github.com/geoscixyz/geosci-labs/blob/master/images/em/CoordinatesUXO.png?raw=true\">\n",
    "\n",
    "## Coordinates and Primary Polarizations\n",
    "\n",
    "The polarizability tensor for an object depends on its orientation, dimensions and electromagnetic properties. Because the polarizability tensor is SPD, it can be decomposed using the following eigen-decomposition:\n",
    "\n",
    "\\begin{equation}\n",
    "{\\bf Q = A \\, L(t) \\, A^T}\n",
    "\\end{equation}\n",
    "\n",
    "where\n",
    "\n",
    "\\begin{equation}\n",
    "{\\bf A} = \\begin{bmatrix} a_{11} & a_{12} & a_{13} \\\\ a_{12} & a_{22} & a_{23} \\\\ a_{13} & a_{23} & a_{33} \\end{bmatrix} \\;\\;\\;\\; \\textrm{and} \\;\\;\\;\\;\n",
    "{\\bf L(t)} = \\begin{bmatrix} L_{x'}(t) & 0 & 0 \\\\ 0 & L_{y'}(t) & 0 \\\\ 0 & 0 & L_{z'}(t) \\end{bmatrix}\n",
    "\\end{equation}\n",
    "\n",
    "${\\bf A}$ is a SPD rotation matrix from the coordinate system defined by the UXO ($x',y',z'$) to the field coordinate system ($x,y,z$). ${\\bf A}$ is defined by three angles: $\\psi,\\theta$ and $\\phi$. $\\theta$ is the azimuthal angle (angle relative to vertical), $\\phi$ is the declination (angle relative to North) and $\\psi$ is the roll (rotation about z' axis). \n",
    "\n",
    "${\\bf L(t)}$ characterizes the primary polarizabilities of the object. The magnetic dipole moment experienced by the object is a linear combination of polarizabilities $L_{x'},L_{y'}$ and $L_{z'}$. Depending on the dimensions and of the object, $L_{x'},L_{y'}$ and $L_{z'}$ may differ. For example:\n",
    "\n",
    "* A sphere has primary polarizabilities $L_{x'}=L_{y'}=L_{z'}$\n",
    "* A UXO has primary polarizabilities $L_{x'}=L_{y'}<L_{z'}$\n",
    "\n",
    "For a given axis $i$, the primary polarizability for a step-off response at $t>0$ is given by:\n",
    "\n",
    "\\begin{equation}\n",
    "L_{ii}(t) = k_i \\Bigg ( 1 + \\frac{t^{1/2}}{\\alpha_i^{1/2}} \\Bigg )^{-\\beta_i} e^{-t/\\gamma_i}\n",
    "\\end{equation}\n",
    "\n",
    "where the decay of the object's polarization is determined by parameters $k_i,\\alpha_i,\\beta_i$ and $\\gamma_i$.\n",
    "\n",
    "<img style=\"float: right; width: 500px\" src=\"https://github.com/geoscixyz/geosci-labs/blob/master/images/em/UXOschematic.png?raw=true\">\n",
    "\n",
    "## Predicting Data\n",
    "\n",
    "There are a multitude of instruments used to measure the time-domain responses exhibited by UXOs (EM61, TEMTADS, MPV). For each individual measurement, a transmitter loop produces a primary magnetic field ${\\bf h_p} = [h_x,h_y,h_z]^T$ which is turned off a $t=0$. The primary field polarizes the UXO according to its polarizability tensor ${\\bf Q}$. The polarization of the object produces a secondary field which induces an EMF in one or more receiver coils. The field component being measured by each receiver coil depends on its orientation.\n",
    "\n",
    "Where ${\\bf G} = [g_x,g_y,g_z]$ maps the dipole moment experienced by the object to the induced voltage in a receiver coil:\n",
    "\n",
    "\\begin{equation}\n",
    "d = {\\bf G \\, m} = {\\bf G \\, Q \\, h_p}\n",
    "\\end{equation}\n",
    "\n",
    "Because it is SPD, the polarizability tensor may be characterized at each time by 6 parameters $(q_{11},q_{12},q_{13},q_{22},q_{23},q_{33})$. The previous expression can ultimately be reformulated as:\n",
    "\n",
    "\\begin{equation}\n",
    "d = {\\bf P \\, q}\n",
    "\\end{equation}\n",
    "\n",
    "where\n",
    "\n",
    "\\begin{equation}\n",
    "{\\bf q^T} = [q_{11} \\;\\; q_{12} \\;\\; q_{13} \\;\\; q_{22}\\;\\; q_{23} \\;\\; q_{33}]\n",
    "\\end{equation}\n",
    "\n",
    "and\n",
    "\n",
    "\\begin{equation}\n",
    "{\\bf P} = [h_xg_x \\;\\; h_xg_y \\!+\\! h_yg_x \\;\\; h_xg_z \\!+\\! h_zg_x \\;\\; h_zg_y \\;\\; h_yg_z \\!+\\! h_zg_y \\;\\; h_zg_z]\n",
    "\\end{equation}\n",
    "\n",
    "Thus in the case that there are $N$ distinct transmitter-receiver pair, each transmitter-receiver pair is represented as a row within ${\\bf P}$. ${\\bf q}$ contains all the necessary information to construct ${\\bf Q}$ and ${\\bf P}$ contains all the geometric information associated with the problem.\n",
    "\n",
    "## Inversion and Parameter Estimation\n",
    "\n",
    "When inverting field-collected UXO data there are two primary goals:\n",
    "\n",
    "* Accurate location of a target object (recover $x,y,z$)\n",
    "* Accurate characterization of a target object (by recovering $L_{x'},L_{y'},L_{z'}$)\n",
    "\n",
    "For this widget, we will accomplish these goals in two steps.\n",
    "\n",
    "### Step 1\n",
    "\n",
    "In step 1, we intend to recover the location of the target $(x,y,z)$ and the elements of the polarizability tensor $(q_{11},q_{12},q_{13},q_{22},q_{23},q_{33})$ at each time. A basic approach is applied by finding the location and polarizabilities which minimize the following data misfit function:\n",
    "\n",
    "\\begin{equation}\n",
    "\\begin{split}\n",
    "\\Phi &= \\sum_{i=k}^K \\Big \\| {\\bf W_k} \\big ( {\\bf P \\, q_k - d_{k,obs}} \\big ) \\Big \\|^2 \\\\\n",
    "& \\textrm{s.t.} \\\\\n",
    "& q_{min} \\leq q_{ij}(t) \\leq q_{max} \\\\\n",
    "& q_{ii}(t) \\geq 0 \\\\\n",
    "& \\big | q_{ij}(t) \\big | \\leq \\frac{1}{2} \\big ( \\; \\big | q_{ii}(t) \\big | + \\big | q_{jj}(t) \\big | \\; \\big )\n",
    "\\end{split}\n",
    "\\end{equation}\n",
    "\n",
    "where ${\\bf P}$ depends on the location of the target, $i$ refers to the time-channel, $d_{i,obs}$ is the observed data at time $i$ and ${\\bf W_i}$ are a set of weights applied to the data misfit. The constraint assures that negative polarizabilities (non-physical) are not recovered in order to fit the data.\n",
    "\n",
    "### Step 2\n",
    "\n",
    "Once recovered, ${\\bf q}$ at each time can be used to construct the corresponding polarizability tensor ${\\bf Q}$. Recall that the eigen-decomposition of ${\\bf Q}$ is given by:\n",
    "\n",
    "\\begin{equation}\n",
    "{\\bf Q = A \\, L(t) \\, A^T}\n",
    "\\end{equation}\n",
    "\n",
    "Thus $L_{x'}(t),L_{y'}(t),L_{z'}(t)$ are just the eigenvalues of ${\\bf Q}$ and the elements of the rotation matrix ${\\bf A}$ are the eigenvectors. Once $L_{x'},L_{y'},L_{z'}$ have been recovered at all times, the curves can be compared against the known primary polarizabilities of objects which are stored in a library.\n",
    "\n",
    "### Practical Considerations\n",
    "\n",
    "**Sampling Density:** The optimum line and station spacing depends significantly on the dimensions of the target, its depth and the system being used to perform the survey. It is important to use a sampling density which accurately characterizes TEM anomalies without adding unnecessary time and expense.\n",
    "\n",
    "**Excitation Orientation:** The excitation of a buried target occurs parallel to the inducing field. Thus in order to accurately recover polarizations $L_{x′},L_{y′}$ and $L_{z′}$ for the target, we must excite the target significantly from multiple angles. Ideally, the target would be excited from 3 orthogonal directions; thus assuring the data contains significant contributions from each polarization."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Orientation and Polarization Widget\n",
    "\n",
    "### Purpose\n",
    "\n",
    "This app allows the user to visualize the orientation, approximate dimensions and polarizability of compact objects they wish to model with subsequent apps.\n",
    "\n",
    "### Parameter Descriptions\n",
    "\n",
    "* $\\Phi$: Clockwise rotation about the z-axis\n",
    "* $\\theta$: Azimuthal angle (angle from vertical)\n",
    "* $\\phi$: Declination angle (Clockwise angle from North)\n",
    "* $k_i,\\alpha_i,\\beta_i,\\gamma_i$: Parameters which characterize the polarization along axis $i$"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "7c99817dc3474ec7b1cdc24739c2d740",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "HBox(children=(FloatSlider(value=-0.0, continuous_update=False, description='$\\\\psi$', max=180.0, min=-180.0, …"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "a72f6458f24447a7bb494834478e40d1",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "HBox(children=(FloatSlider(value=1.0, continuous_update=False, description=\"$k_{x'}$\", max=3.0, min=1.0), Floa…"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "ee5e1e373f3f4796a6ae7ee01cd93861",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "HBox(children=(FloatSlider(value=1.5, continuous_update=False, description=\"$k_{y'}$\", max=3.0, min=1.0), Floa…"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "937cf89081d4485f9c774e80301143a8",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "HBox(children=(FloatSlider(value=2.0, continuous_update=False, description=\"$k_{z'}$\", max=3.0, min=1.0), Floa…"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "dce530ee1297416b833bbc0a81fc2d88",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "IntSlider(value=1, continuous_update=False, description='Time channel', max=11, min=1)"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "f20e4389a7c64e179ab3284545a8ea1b",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "Output()"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# NOTE: INITIATE WIDGET BY ADJUSTING ANY PARAMETER!!!\n",
    "\n",
    "Out1 = UXO.ImageUXOWidget()\n",
    "display(HBox(Out1.children[0:3]))\n",
    "display(HBox(Out1.children[3:7]))\n",
    "display(HBox(Out1.children[7:11]))\n",
    "display(HBox(Out1.children[11:15]))\n",
    "display(Out1.children[15])\n",
    "Out1.out"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Data Visualization Widget\n",
    "\n",
    "### Purpose\n",
    "\n",
    "This widget allows the user to visualize the time-domain response using three commonly used instruments: EM61, TEMTADS, and MPV. On the leftmost plot, the TEM anomaly at the center of the transmitter loop is plotted at a specified time. On the rightmost plot, the TEM decays registered by all receiver coils for a particular transmitter loop are plotted.\n",
    "\n",
    "### Parameter Descriptions\n",
    "\n",
    "* TxType: Instrument used to predict data. Set as \"EM61\", \"TEMTADS\" or \"MPV\"\n",
    "* $x_{true},y_{true},z_{true}$: Location of the object\n",
    "* $\\psi,\\theta,\\phi$: Angles defining the orientation of the object\n",
    "* $k_i,\\alpha_i,\\beta_i,\\gamma_i$: Parameters which characterize the polarization along axis $i$\n",
    "* Time channel: Adjusts the time in which the TEM anomaly at the center of the transmitter loop is plotted\n",
    "* X location, Y location: The transmitter location at which you would like to see all decays measured by the receiver coils."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "a1317f14dafa43df877f3d2aec58286d",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "HBox(children=(FloatSlider(value=0.0, continuous_update=False, description='$x_{true}$', max=2.0, min=-2.0, st…"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "ea9cd4b8243c456199a4f0a34a8c29d3",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "HBox(children=(FloatSlider(value=-0.0, continuous_update=False, description='$\\\\psi$', max=180.0, min=-180.0, …"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "e60f60db77904a058280fce969c07eeb",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "HBox(children=(FloatSlider(value=1.0, continuous_update=False, description=\"$k_{x'}$\", max=3.0, min=1.0), Floa…"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "93e022f7bfaa410c92f995bfc2f6f04b",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "HBox(children=(FloatSlider(value=1.5, continuous_update=False, description=\"$k_{y'}$\", max=3.0, min=1.0), Floa…"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "fd77099c85624b2bbed00dd3187fb206",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "HBox(children=(FloatSlider(value=2.0, continuous_update=False, description=\"$k_{z'}$\", max=3.0, min=1.0), Floa…"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "7a4409054f9f42c19d94b1fb8b6c48d1",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "HBox(children=(IntSlider(value=1, continuous_update=False, description='Time channel', max=11, min=1), FloatSl…"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "3fdbb00f628f4fa1a1dee88ed3e17a6e",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "Output()"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# NOTE: INITIATE WIDGET BY ADJUSTING ANY PARAMETER!!!\n",
    "\n",
    "TxType = \"EM61\" # Set TxType to \"EM61\", \"TEMTADS\" or \"MPV\"\n",
    "\n",
    "Out2 = UXO.ImageDataWidget(TxType)\n",
    "display(HBox(Out2.children[0:3]))\n",
    "display(HBox(Out2.children[3:6]))\n",
    "display(HBox(Out2.children[6:10]))\n",
    "display(HBox(Out2.children[10:14]))\n",
    "display(HBox(Out2.children[14:18]))\n",
    "display(HBox(Out2.children[18:21]))\n",
    "if TxType is \"MPV\":\n",
    "    display(Out2.children[21])\n",
    "Out2.out"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Parameter Estimation Widget\n",
    "\n",
    "### Purpose\n",
    "\n",
    "This widget allows the user to invert synthetic data using EM61, TEMTADS or MPV instruments in order to recover the location and primary polarizabilities for a compact object. The goal of this app is to demonstrate how successful recovery depends on:\n",
    "\n",
    "* Sampling density\n",
    "* Excitation orientation\n",
    "\n",
    "### Parameter Descriptions\n",
    "\n",
    "* TxType: Instrument used for simulation. Set as \"EM61\", \"TEMTADS\" or \"MPV\"\n",
    "* $x_{true},y_{true},z_{true}$: True location of the object\n",
    "* $\\psi,\\theta,\\phi$: True angles defining the orientation of the object\n",
    "* $k_i,\\alpha_i,\\beta_i,\\gamma_i$: True parameters which characterize the polarization of the object along axis $i$\n",
    "* $D_x,D_y$: The x-width and y-width for the cued-interrogation region\n",
    "* $N_x,N_y$: The number of stations in the x and y direction\n",
    "* $x_0,y_0,z_0$: Starting guess for the location of the object"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "ef06801377e24dcd83e363bd58f96fbc",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "HBox(children=(FloatSlider(value=0.0, continuous_update=False, description='$x_{true}$', max=2.0, min=-2.0, st…"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "5c1d820ec3a243f998c353504fa4abb4",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "HBox(children=(FloatSlider(value=-0.0, continuous_update=False, description='$\\\\psi$', max=180.0, min=-180.0, …"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "682a934465c34f17b8994afec00a8b1e",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "HBox(children=(FloatSlider(value=1.0, continuous_update=False, description=\"$k_{x'}$\", max=3.0, min=1.0), Floa…"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "b98eb4a8bb064973ae94bfc33bd3d125",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "HBox(children=(FloatSlider(value=1.5, continuous_update=False, description=\"$k_{y'}$\", max=3.0, min=1.0), Floa…"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "e45c76ce616541c490a435eb8c522fc7",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "HBox(children=(FloatSlider(value=2.0, continuous_update=False, description=\"$k_{z'}$\", max=3.0, min=1.0), Floa…"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "1b5a3be3b5df44fa849573bc85eb931f",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "HBox(children=(FloatSlider(value=4.0, continuous_update=False, description='$D_x$', max=5.0, min=0.1), FloatSl…"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "b69244cc3f2e4888bfc0d3e476d3ab45",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "HBox(children=(FloatSlider(value=0.2, continuous_update=False, description='$x_0$', max=3.0, min=-3.0, step=0.…"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "88041f660358429aae314e1b3aadd20b",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "IntSlider(value=1, continuous_update=False, description='Time channel', max=11, min=1)"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "d8ff41dc07204e348776a545a3288cd7",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "Output()"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# NOTE: INITIATE WIDGET BY ADJUSTING ANY PARAMETER!!!\n",
    "\n",
    "TxType = \"EM61\" # Set TxType to \"EM61\", \"TEMTADS\" or \"MPV\"\n",
    "\n",
    "Out3 = UXO.InversionWidget(TxType)\n",
    "display(HBox(Out3.children[0:3]))\n",
    "display(HBox(Out3.children[3:6]))\n",
    "display(HBox(Out3.children[6:10]))\n",
    "display(HBox(Out3.children[10:14]))\n",
    "display(HBox(Out3.children[14:18]))\n",
    "display(HBox(Out3.children[18:22]))\n",
    "display(HBox(Out3.children[22:25]))\n",
    "if TxType is \"MPV\":\n",
    "    display(HBox(Out3.children[25:27]))\n",
    "else:\n",
    "    display(Out3.children[25])\n",
    "Out3.out"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
